package com.small.sentinel.slotchain;

import com.small.sentinel.EntryType;

/**
 * 资源包装器
 */
public abstract class ResourceWrapper {

    /**
     * 资源名称
     */
    protected final String name;

    /**
     * 进入类型
     */
    protected final EntryType entryType;

    /**
     * 资源类型
     */
    protected final int resourceType;

    public ResourceWrapper(String name, EntryType entryType, int resourceType) {
        this.name = name;
        this.entryType = entryType;
        this.resourceType = resourceType;
    }

    public String getName() {
        return name;
    }

    public EntryType getEntryType() {
        return entryType;
    }

    public int getResourceType() {
        return resourceType;
    }

    @Override
    public int hashCode() {
        return getName().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ResourceWrapper) {
            ResourceWrapper rw = (ResourceWrapper)obj;
            return rw.getName().equals(getName());
        }
        return false;
    }
}
